// 封装路由地址
import {lazy} from 'react'

var Index=lazy(()=>import("../views/Index"))
var Good=lazy(()=>import('../views/Good'))
var MyLogin=lazy(()=>import("../views/MyLogin"))
var MyRegister=lazy(()=>import("../views/MyRegister"))
var Collect=lazy(()=>import("../views/Collect"))
var NotFound=lazy(()=>import("../views/NotFound"))

var Home=lazy(()=>import("../views/Index/Home"))
var Cart=lazy(()=>import("../views/Index/Cart"))
var Cate=lazy(()=>import("../views/Index/Cate"))
var Goods=lazy(()=>import("../views/Index/Goods"))
var Mine=lazy(()=>import("../views/Index/Mine"))

export default [{
    path: '/index',
    component: Index,
    children:[
            {
                path:'/index/home',
                component:Home
            },{
                path:'/index/cart',
                component:Cart
            },{
                path:'/index/cate',
                component:Cate
            },{
                path:'/index/goods/:id',
                component:Goods
            },{
                path:'/index/mine',
                component:Mine
            },{
                from:'/index',
                to:'/index/home',
                redirect:true,
            },{
                component:NotFound
            }
    ]
},{
    path:'/good/:goodid',
    component:Good
},{
    path: '/login',
    component: MyLogin,
},{
    path: '/collect',
    component: Collect,
},{
    path: '/register',
    component: MyRegister,
},{
    from: '/',
    to:'/index',
    redirect: true,
},{
   component:NotFound
}]